Component({
  data: {
    selected: 0,
    color: "#7A7E83", //未选中项文字颜色
    selectedColor: "#2B75FA", //选中项文字颜色
    list: [
      {
        pagePath: "/pages/home/index/index",
        iconPath: "https://security.dfteco.com/resource2/tabbar/menu.svg",
        selectedIconPath:
          "https://security.dfteco.com/resource2/tabbar/menu_active.svg",
        text: "菜单",
      },
      {
        pagePath: "/pages/message/index/index",
        iconPath: "https://security.dfteco.com/resource2/tabbar/message.svg",
        selectedIconPath:
          "https://security.dfteco.com/resource2/tabbar/message_active.svg",
        text: "消息",
      },
      {
        pagePath: "/pages/personcenter/index/index",
        iconPath: "https://security.dfteco.com/resource2/tabbar/my.svg",
        selectedIconPath:
          "https://security.dfteco.com/resource2/tabbar/my_active.svg",
        text: "个人",
      },
    ],
  },
  attached() {},
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset;
      const url = data.path;
      wx.switchTab({ url });
      this.setData({
        selected: data.index,
      });
    },
  },
});
